package health.lm.com.mine.present;

import health.lm.com.component_base.base.mvp.contract.XPresent;
import health.lm.com.mine.entity.MineTotalBean;
import health.lm.com.mine.entity.SettingBean;
import health.lm.com.mine.entity.ShareEntity;
import health.lm.com.mine.entity.WalletEntity;
import health.lm.com.mine.fragment.MineFragment;
import health.lm.com.mine.model.MineModel;
import health.lm.com.network.callback.SimpleCallBack;

/**
 * @author GQI
 * @description:
 * @date :2019-06-12 17:33
 */
public class MinePresent extends XPresent<MineFragment> {
    public void getData(){
        MineModel.getInstance().mineFragment(new SimpleCallBack<MineTotalBean>() {
            @Override
            public void onSuccess(MineTotalBean mineTotalBean) {
                if(hasV()) {
                    getV().getDataSuccess(mineTotalBean);
                }
            }
        });
    }

    public void getShareData(String phone) {
        MineModel.getInstance().getShareData(phone, new SimpleCallBack<ShareEntity>() {
            @Override
            public void onSuccess(ShareEntity pShareEntity) {
                if (hasV()) getV().share(pShareEntity);
            }
        });
    }

    public void initWallet(String password) {
        MineModel.getInstance().walletData(password, new SimpleCallBack<WalletEntity>() {
            @Override
            public void onSuccess(WalletEntity pEntity) {
                if (hasV()) getV().jumpWallet(pEntity.getUrl());
            }
        });
    }
}
